package servlet;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.*;
import model.Goods;
import service.GoodsService;

import java.io.IOException;

@WebServlet(name="AdminGoodsEditshowServlet",value = "/AdminGoodsEditshowServlet")

public class AdminGoodsEditshowServlet extends HttpServlet {
    private GoodsService goodsService =new GoodsService();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int id = Integer.parseInt(request.getParameter("id"));
        Goods goods=goodsService.getGoodsById(id);
        request.setAttribute("g",goods);
        System.out.println(goods+"===");
        request.getRequestDispatcher("UpdateGoods.jsp").forward(request, response);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
